-- butcher_kill
-- created by zhuangsl
-- 每杀死n个有生命的敌人，增加属性

return {
    apply = function(prop, baseValue)
        return prop[3];
    end,

    -- 击杀触发
    trigger = function(who, prop, arg)
        local target = arg;
        if not FormulaM.invoke("IS_LIVING_TARGET", target) then
            -- 不是有生命的敌人，直接返回
            return;
        end

        -- 计数
        DungeonServiceM.addDungeonAttrib("butcher_kill", 1);

        -- 数量是否足够
        if DungeonServiceM.queryDungeonAttrib("butcher_kill") < prop[3] then
            return;
        end

        -- 先清空计数
        DungeonServiceM.costDungeonAttrib({["butcher_kill"] = prop[3]});

        local bonus = { 2, prop[2], 1, };
        BonusM.doBonus(bonus, "butcher_kill");

        -- 特技发动事件
        EventMgr.fire(event.SPECIAL_SKILL_TRIGGER, { propId = prop[1] });

        return true;
    end,

    record = function(target, prop, path)
        return false;
    end
};
